/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-10-01
 * Time: 12:19
 */
public class subset_XORSum {
    static int ret=0;
    static int sum=0;
    public static int subsetXORSum(int[] nums) {
        dfs(nums,0);
        return ret;
    }

    private static void dfs(int[] nums,int pos) {
        ret+=sum;
        for (int i = pos; i < nums.length; i++) {
            sum^=nums[i];
            dfs(nums,i+1);
            sum^=nums[i];
        }
    }

    public static void main(String[] args) {
        int n=1^0;
        System.out.println(n^1);
        int[] nums={3,4,5,6,7,8};
        System.out.println(subsetXORSum(nums));
    }
}
